package com.lj.utils.controller;

import com.lj.utils.result.ResultCode;
import com.lj.utils.result.ResultVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luojing
 * @create 2021/4/15
 */
@RestController
@RequestMapping("/test")
public class TestController {

    /**
     * @return   {"code":200,"msg":"OK","data":"hello"}
     */
    @GetMapping("/sayHello")
    public String sayHello(){
        return "hello";
    }

    /**
     * @return  {"code":400,"msg":"Bad Request","data":"我是错误信息！"}
     */
    @GetMapping("/error")
    public ResultVO errorMessage(){
        return new ResultVO(ResultCode.BAD_REQUEST,"我是错误信息！");
    }
}
